<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div class="page">
    <% include components/top.inc.ejs %>
    <div>
      <form action="?" method="post">
        <p>标题：<input type="text" name="title" /></p>
        <p>小图：<input type="text" name="pic_src" /></p>
        <p>大图：<input type="text" name="big_pic_src" /></p>
        <p>摘要：<textarea name="summary"></textarea></p>
        <p>内容：<textarea name="content"></textarea></p>
        <!-- <p>发布时间：<input type="text" name="post_time" /></p> -->
        <p>作者：<input type="text" name="author" /></p>
        <!-- <p>查看人数：<input type="text" name="n_view" /></p> -->
        <p><input type="submit" value="添加" /></p>
      </form>
    </div>
    <table border="1" width="90%">        
      <tbody>
        <tr>
          <th>ID</th>
          <th>标题</th>
          <th>小图</th>
          <th>大图</th>
          <th>摘要</th>
          <th>内容</th>
          <th>发布时间</th>
          <th>作者</th>
          <th>查看人数</th>
        </tr>
      </tbody>
      <tbody>
        <% for (var i=0; i<blogs.length; i++) { %>
        <% 
          var d = new Date(blogs[i].post_time * 1000)
          var day = d.getDate()
          var month = d.getMonth() + 1
          var year = d.getFullYear()
        %>
        <tr>
          <td><%= blogs[i].id %></td>
          <td><%= blogs[i].title %></td>
          <td><img src="<%= blogs[i].pic_src %>" height="30" /></td>
          <td><img src="<%= blogs[i].big_pic_src %>" height="30" /></td>
          <td><%= blogs[i].summary %></td>
          <td><%= blogs[i].content %></td>
          <td><%= year + "/" + month + "/" + day %></td>
          <td><%= blogs[i].author %></td>
          <td><%= blogs[i].n_view %></td>
        </tr>
        <% } %>          
      </tbody>
    </table>
  </div>
</body>
</html>